//页脚生成通用方法

function createPager(totalPages,pageNo,container,size) {
	 $("#"+container).html("");
	 if(pageNo==1){
	   $("#"+container).append('<span id="prepage" class="preOrnexthui">上一页</span> ');
	 }else{
	   $("#"+container).append('<span id="prepage" class="preOrnext" onclick="ChangePage('+(pageNo-1)+')">上一页</span> ');
	 }
	 var count=pageNo%size;
	 if(count!=0){
		 for(var i=1;i<count;i++){
			 $("#"+container).append(' <span class="pnum" onclick="ChangePage('+(pageNo-count+i)+')">'+(pageNo-count+i)+'</span> ');
		 }
		 $("#"+container).append('<span class="currentpage">'+pageNo+'</span> ');
		 for(var i=1;i<size-count+1;i++){
			 if(pageNo+i<totalPages+1){
			 $("#"+container).append(' <span class="pnum" onclick="ChangePage('+(pageNo+i)+')">'+(pageNo+i)+'</span> ');
		   }
		 }
	 }else{
		 for(var i=1;i<size;i++){
			 $("#"+container).append(' <span class="pnum" onclick="ChangePage('+(pageNo-size+i)+')">'+(pageNo-size+i)+'</span> ');
		 }
		 $("#"+container).append('<span class="currentpage">'+pageNo+'</span> ');
	 }
	 
	 if(pageNo==totalPages){
		   $("#"+container).append('<span id="nextpage" class="preOrnexthui next">下一页</span> ');
		 }else{
		   $("#"+container).append('<span id="nextpage" class="preOrnext next" onclick="ChangePage('+(pageNo+1)+')">下一页</span> ');
		 }
	 $("#"+container).append('<span class="totalpage">共 '+totalPages+' 页</span> ');
	 var left=($('#nextpage').parent().width()-($('#nextpage').position().left+54))/2;
		$("#prepage").css("margin-left",left);
		$("#prepage").css("display","inline");
}